// Animal 父类 ->  Dog 子类
// 1. extends
// 2. super
class Animal{
    constructor(name){
        this.name=name;
        this.thirst=100;
        this.belly=[];
    }
    drink(){
        this.thirst-=10;
        return this; //返回this可以实现this调用
    }
    eat(food){
        this.belly.push(food);
        return this;
    }
}
class Dog extends Animal{
    constructor(name,breed){
        super(name);// 继承父类
        this.breed=breed;// 子类有的
    }
    bark(){
        console.log('BARK BARK BARK!');
    }
}
const sunny =new Dog('sunny');
// console.log(sunny.name);
sunny   // 链式调用
    .eat('烤鱼')
    .drink()
    .eat('火锅')
    .drink()
console.log(sunny.thirst,sunny.belly);